﻿using SqlSugar;
using StoreIModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace StoreRepositorys
{
    public interface IRepository<T> where T : class,new()
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="enity"></param>
        /// <returns></returns>
        Task<int> Addasync(T enity);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="enity"></param>
        /// <returns></returns>
        Task<int> Deleteasync(int id);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="enity"></param>
        /// <returns></returns>
        Task<int> Updateasync(T enity);
        /// <summary>
        /// 根据id查询
        /// </summary>
        /// <param name="enity"></param>
        /// <returns></returns>
        Task<T> GetModelasync(int id);
        /// <summary>
        /// 查询全部
        /// </summary>
        /// <returns></returns>
        //ISugarQueryable<T> GetAllasync();
        Task<List<T>> GetAllasync();
        /// <summary>
        /// 拉姆达表达式
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        Task<List<T>> GetAllAsync(Expression<Func<T, bool>> expression);

    }
}
